package com.zhang.publicproject.common.adapter;

import android.view.View;
import android.view.ViewGroup;

import com.zhang.publicproject.common.base.BaseHolder;

import java.util.List;

/**
 * Created by Administrator on 2016/4/26 0026.
 * 张寰宇
 */
public abstract class SuperBaseAdapter<ITEMBEANTYPE> extends MyBaseAdapter {
    public SuperBaseAdapter(List dataSet) {
        super(dataSet);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        BaseHolder baseHolder = null;
        if (convertView == null) {
            baseHolder = getSpecialHolder(position);
        } else {
            baseHolder = (BaseHolder) convertView.getTag();
        }
        if (dataSet != null && dataSet.size() != 0) {
            baseHolder.setDataAndRefreshHolderView( dataSet.get(position));
        }


        return baseHolder.mHolderView;
    }

    public abstract BaseHolder getSpecialHolder(int position);


}

